package zlatan_demo04_companion

object ClassDemo01 {

  class Generals {
    def toWar(): Unit = println(s"武将拿着${Generals.armsName}武器")
  }

  //伴生对象
  object Generals {
    private val armsName = "青龙偃月刀"
  }

  def main(args: Array[String]): Unit = {
    val c = new Generals
    c.toWar()
  }
}
